package stack.era.domain;

import java.io.Serializable;

public abstract class DomainObject implements Serializable {

	private static final long serialVersionUID = 5586560120824738753L;

	protected int id;
	protected String name;

	public DomainObject(String newName) {
		this.id = DomainObject.generateNewID();
		this.name = newName;

		DomainController.getInstance().registerToSummary(this.name, this);
	}

	public int getID() {
		return id;
	}

	public String getName() {
		return name;
	}

	private static int generateNewID() {
		return (int) ((Math.random() * 100) + System.nanoTime());
	}

	public abstract void update();

}
